import { getMongoRepository } from 'typeorm'
import { Majors } from '../models/Majors'


export class MajorService {
  findAll() {
    const majorRepository = getMongoRepository(Majors)
    return majorRepository.find()
  }

  // 根据班级名称
  async findByMajorName(major_name: string) {
    const majorRepository = getMongoRepository(Majors)
    return majorRepository.findOne({ major_name })
  }
}

export default new MajorService()